package eight;

import java.util.Scanner;

public enum Season {
    //表示Season的固定的4个对象，都是常量
//public static final Season SPRING = new Season("春天","暖和");
    SPRING("春天","暖和",2),
    SUMMER("夏天","热",5),
    AUTUMN("秋天","凉爽",8),
    WINTER("冬天","冷",11);
    private String seasonName;
    private String seasonDesc;
    private int seasonStart;
    Season(String seasonName, String seasonDesc,int seasonStart) {
        this.seasonName = seasonName;
        this.seasonDesc = seasonDesc;
        this.seasonStart = seasonStart;
    }
    public String getSeasonName() {
        return seasonName;
    }
    public void setSeasonName(String seasonName) {
        this.seasonName = seasonName;
    }
    public String getSeasonDesc() {
        return seasonDesc;
    }
    public void setSeasonDesc(String seasonDesc) {
        this.seasonDesc = seasonDesc;
    }
    public int getSeasonStart() {
        return seasonStart;
    }
    public void setSeasonStart(String seasonDesc) {
        this.seasonStart = seasonStart;
    }
}
class EnumDemo {
    public static void main(String[] args) {
        Season[] seasons = Season.values(); //获取所有枚举的对象
        for(int i=0;i<seasons.length;i++){
            System.out.println(seasons[i]); //输出4个枚举对象(SPRING、SUMMER、AUTUMN、WINTER)
            System.out.println(seasons[i].getSeasonName()); //输出枚举的名字属性
            System.out.println(seasons[i].getSeasonDesc()); //输出枚举的描述属性
            System.out.println(seasons[i].getSeasonStart());
        }
        Season s = Season.WINTER; //获取SPRING对象
        System.out.println(s.getSeasonName()+"，"+s.getSeasonDesc());
        Scanner input=new Scanner(System.in);
        //接受String类型
        System.out.println("输入季节：");
        String str1=input.next();
        s.setSeasonName(str1);
        System.out.println("输入描述：");
        String str2=input.next();
        s.setSeasonDesc(str2);
        System.out.println(s.getSeasonName()+"，"+s.getSeasonDesc());
        switch (s){
            case SPRING:
                System.out.println("天气"+s.getSeasonDesc()+"，放风筝去喽!");
                break;
            case SUMMER:
                System.out.println("天气"+s.getSeasonDesc()+"，游戏去喽!");
                break;
            case AUTUMN:
                System.out.println("天气"+s.getSeasonDesc()+"摘苹果去喽!");
                break;
            case WINTER:
                System.out.println("天气"+s.getSeasonDesc()+"打雪仗去喽!");
                break;
        }
    }
}
